<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="FTP," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FTP 是 File Transfer Protocol （文件传输协议）的英文简称，而中文简称为“文传协议”用于 Internet 上的控制文件的双向传输。同时，它也是一个应用程序（Applocation）用户可以通过它把自己的 PC 机与世界各地所有运行 FTP 协议的服务器相连，访问服务器上的大量">
<meta name="keywords" content="FTP">
<meta property="og:type" content="article">
<meta property="og:title" content="pureftp部署和优化">
<meta property="og:url" content="https://hcldirgit.github.io/2017/09/03/FTP/1. pureftp部署和优化/index.html">
<meta property="og:site_name" content="失落的乐章">
<meta property="og:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FTP 是 File Transfer Protocol （文件传输协议）的英文简称，而中文简称为“文传协议”用于 Internet 上的控制文件的双向传输。同时，它也是一个应用程序（Applocation）用户可以通过它把自己的 PC 机与世界各地所有运行 FTP 协议的服务器相连，访问服务器上的大量">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/pureftp%E9%83%A8%E7%BD%B2%E5%92%8C%E4%BC%98%E5%8C%96/01.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/pureftp%E9%83%A8%E7%BD%B2%E5%92%8C%E4%BC%98%E5%8C%96/02.png?raw=true">
<meta property="og:image" content="https://github.com/hcldirgit/image/blob/master/pureftp%E9%83%A8%E7%BD%B2%E5%92%8C%E4%BC%98%E5%8C%96/03.png?raw=true">
<meta property="og:updated_time" content="2017-09-01T08:48:52.797Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="pureftp部署和优化">
<meta name="twitter:description" content="&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FTP 是 File Transfer Protocol （文件传输协议）的英文简称，而中文简称为“文传协议”用于 Internet 上的控制文件的双向传输。同时，它也是一个应用程序（Applocation）用户可以通过它把自己的 PC 机与世界各地所有运行 FTP 协议的服务器相连，访问服务器上的大量">
<meta name="twitter:image" content="https://github.com/hcldirgit/image/blob/master/pureftp%E9%83%A8%E7%BD%B2%E5%92%8C%E4%BC%98%E5%8C%96/01.png?raw=true">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://hcldirgit.github.io/2017/09/03/FTP/1. pureftp部署和优化/"/>





  <title>pureftp部署和优化 | 失落的乐章</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', '85*****1', 'auto');
  ga('send', 'pageview');
</script>


  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?87980c**************99ec5e26fb5";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>











  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">失落的乐章</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">技术面前，永远都是学生。</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-message">
          <a href="/message" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-external-link"></i> <br />
            
            留言
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="https://hcldirgit.github.io/2017/09/03/FTP/1. pureftp部署和优化/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="失落的乐章">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/0.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="失落的乐章">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">pureftp部署和优化</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-09-03T02:02:06+08:00">
                2017-09-03
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;FTP 是 File Transfer Protocol （文件传输协议）的英文简称，而中文简称为“文传协议”用于 Internet 上的控制文件的双向传输。同时，它也是一个应用程序（Applocation）用户可以通过它把自己的 PC 机与世界各地所有运行 FTP 协议的服务器相连，访问服务器上的大量程序和信息。 FTP 的主要作用，就是让用户连接上一个远程计算机（这些计算机上运行着 FTP 服务器程序）查看远程计算机有哪些文件，然后把文件从远程计算机上拷贝到本地计算机。或把本地计算机的文件送到远程计算机去。FTP 用得比 NFS 更多。</p>
<h2 id="安装pure-ftpd"><a href="#安装pure-ftpd" class="headerlink" title="安装pure-ftpd"></a>安装pure-ftpd</h2><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在 centos 或者 redhat linux 上有自带的 ftp 软件叫做 vsftp ，但 pure-ftpd 比 vsftp 配置起来更加灵活。</p>
<h3 id="1-下载软件"><a href="#1-下载软件" class="headerlink" title="1.下载软件"></a>1.下载软件</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;<a href="http://www.pureftpd.org/project/pure-ftpd" target="_blank" rel="external">pure-ftpd 官网</a> </p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># cd /usr/local/src</span></div><div class="line">[root@192 src]<span class="comment"># wget http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.42.tar.bz2</span></div></pre></td></tr></table></figure>
<h3 id="2-安装-pure-ftpd"><a href="#2-安装-pure-ftpd" class="headerlink" title="2.安装 pure-ftpd"></a>2.安装 pure-ftpd</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 src]<span class="comment"># tar jxvf pure-ftpd-1.0.42.tar.bz2 </span></div><div class="line">[root@192 src]<span class="comment"># cd pure-ftpd-1.0.42</span></div></pre></td></tr></table></figure>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">./configure \</div><div class="line">--prefix=/usr/<span class="built_in">local</span>/pureftpd \</div><div class="line">--without-inetd \</div><div class="line">--with-altlog \</div><div class="line">--with-puredb \</div><div class="line">--with-throttling \</div><div class="line">--with-peruserlimits \</div><div class="line">--with-tls</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编译报错</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">configure: error: <span class="keyword">in</span> `/usr/<span class="built_in">local</span>/src/pure-ftpd-1.0.42<span class="string">':</span></div><div class="line"><span class="string">configure: error: no acceptable C compiler found in $PATH</span></div><div class="line"><span class="string">See `config.log'</span> <span class="keyword">for</span> more details</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;解决办法：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum install -y gcc</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;编译报错：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">configure: error: OpenSSL headers not found.</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;解决办法：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">yum install -y openssl-devel</div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/pureftp%E9%83%A8%E7%BD%B2%E5%92%8C%E4%BC%98%E5%8C%96/01.png?raw=true" alt=""></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 pure-ftpd-1.0.42]<span class="comment"># make &amp;&amp; make install</span></div></pre></td></tr></table></figure>
<h3 id="3-配置-pure-ftpd"><a href="#3-配置-pure-ftpd" class="headerlink" title="3.配置 pure-ftpd"></a>3.配置 pure-ftpd</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">[root@192 pure-ftpd-1.0.42]<span class="comment"># cd configuration-file/</span></div><div class="line">[root@192 configuration-file]<span class="comment"># mkdir -p /usr/local/pureftpd/etc/</span></div><div class="line">[root@192 configuration-file]<span class="comment"># cp pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf</span></div><div class="line">[root@192 configuration-file]<span class="comment"># cp pure-config.pl /usr/local/pureftpd/sbin/pure-config.pl</span></div><div class="line">[root@192 configuration-file]<span class="comment"># chmod 755 /usr/local/pureftpd/sbin/pure-config.pl</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;在启动 pure-ftpd 之前需要先修改配置文件，配置文件为 /usr/local/pureftpd/etc/pure-ftpd.conf，把自带配置删除</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 configuration-file]<span class="comment"># &gt; /usr/local/pureftpd/etc/pure-ftpd.conf </span></div><div class="line">[root@192 configuration-file]<span class="comment"># vim /usr/local/pureftpd/etc/pure-ftpd.conf</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;加入内容：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div></pre></td><td class="code"><pre><div class="line">ChrootEveryone             yes</div><div class="line">BrokenClientsCompatibility no</div><div class="line">MaxClientsNumber           50</div><div class="line">Daemonize                  yes</div><div class="line">MaxClientsPerIP            8</div><div class="line">VerboseLog                 no</div><div class="line">DisplayDotFiles            yes</div><div class="line">AnonymousOnly              no</div><div class="line">NoAnonymous                no</div><div class="line">SyslogFacility             ftp</div><div class="line">DontResolve                yes</div><div class="line">MaxIdleTime                15</div><div class="line">PureDB                     /usr/<span class="built_in">local</span>/pureftpd/etc/pureftpd.pdb</div><div class="line">LimitRecursion             3136 8</div><div class="line">AnonymousCanCreateDirs     no</div><div class="line">MaxLoad                    4</div><div class="line">AntiWarez                  yes</div><div class="line">Umask                      133:022</div><div class="line">MinUID                     100</div><div class="line">AllowUserFXP               no</div><div class="line">AllowAnonymousFXP          no</div><div class="line">ProhibitDotFilesWrite      no</div><div class="line">ProhibitDotFilesRead       no</div><div class="line">AutoRename                 no</div><div class="line">AnonymousCantUpload        no</div><div class="line">PIDFile                    /usr/<span class="built_in">local</span>/pureftpd/var/run/pure-ftpd.pid</div><div class="line">MaxDiskUsage               99</div><div class="line">CustomerProof              yes</div></pre></td></tr></table></figure>
<h3 id="4-启动-pure-ftpd"><a href="#4-启动-pure-ftpd" class="headerlink" title="4.启动 pure-ftpd"></a>4.启动 pure-ftpd</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 configuration-file]<span class="comment"># cd /usr/local/pureftpd/</span></div><div class="line">[root@192 pureftpd]<span class="comment"># ./sbin/pure-config.pl ./etc/pure-ftpd.conf</span></div></pre></td></tr></table></figure>
<p><img src="https://github.com/hcldirgit/image/blob/master/pureftp%E9%83%A8%E7%BD%B2%E5%92%8C%E4%BC%98%E5%8C%96/02.png?raw=true" alt=""></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;如果启动成功，会显示一行长长的以 Running 开头的信息，否则那就是错误信息。重启会比较麻烦一些，重启可以使用下面的命令来实现：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 pureftpd]<span class="comment"># killall pure-ftpd</span></div><div class="line">[root@192 pureftpd]<span class="comment"># cd /usr/local/pureftpd/;./sbin/pure-config.pl ./etc/pure-ftpd.conf</span></div></pre></td></tr></table></figure>
<h3 id="5-建立帐号"><a href="#5-建立帐号" class="headerlink" title="5.建立帐号"></a>5.建立帐号</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;pure-ftpd 使用的帐号并非 linux 系统帐号，而是虚拟帐号。因为这样做比较安全。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># mkdir -p /data/www/</span></div><div class="line">[root@192 ~]<span class="comment"># useradd www</span></div><div class="line">[root@192 ~]<span class="comment"># chown -R www:www /data/www/</span></div><div class="line">[root@192 ~]<span class="comment"># /usr/local/pureftpd/bin/pure-pw useradd ftp_user1 -uwww -d /data/www/</span></div><div class="line">Password: </div><div class="line">Enter it again:</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;其中，-u 将虚拟用户 ftp_user1 与系统用户 www 关联在一起，也就是说使用 ftp_user1 帐号登录 ftp 后，会以 www 的身份来读取文件或下载文件。 -d 后边的目录为 ftp_user1 账户的家目录，这样可以使 ftp_user1 只能访问其家目录 /data/www/ 。到这里还有最关键的一部，就是创建用户信息数据库文件：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># /usr/local/pureftpd/bin/pure-pw mkdb</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;pure-pw 还可以列出当前的 ftp 帐号，当然也可以删除某个帐号。再创建一个帐号：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># /usr/local/pureftpd/bin/pure-pw useradd ftp_user2 -uwww -d /tmp/</span></div><div class="line">Password: </div><div class="line">Enter it again: </div><div class="line">[root@192 ~]<span class="comment"># /usr/local/pureftpd/bin/pure-pw mkdb</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;列出当前帐号：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># /usr/local/pureftpd/bin/pure-pw list</span></div><div class="line">ftp_user1 /data/www/./ </div><div class="line">ftp_user2 /tmp/./</div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;删除帐号的命令为：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># /usr/local/pureftpd/bin/pure-pw userdel ftp_user2</span></div></pre></td></tr></table></figure>
<h3 id="6-测试-pure-ftpd"><a href="#6-测试-pure-ftpd" class="headerlink" title="6.测试 pure-ftpd"></a>6.测试 pure-ftpd</h3><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;测试需要的工具叫做 lftp ，先安装</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># yum install -y lftp</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;测试：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># touch /data/www/123.txt</span></div><div class="line">[root@192 ~]<span class="comment"># lftp ftp_user1@127.0.0.1</span></div></pre></td></tr></table></figure>
<p> &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;注：登录以后可以用 get 下载，put 上传。也可以用 ftp + ip 登录。</p>
<p><img src="https://github.com/hcldirgit/image/blob/master/pureftp%E9%83%A8%E7%BD%B2%E5%92%8C%E4%BC%98%E5%8C%96/03.png?raw=true" alt=""></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;登录后，使用 ls 命令可以列出当前目录都有什么软件。使用 lftp 工具是为了方便在 linux 系统里测试。最好的测试方法是，在 windows 机器里安装个 ftp 客户端软件（推荐 filezilla-client），然后去远程连接测试。</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;下面使用 yum 安装 pure-ftpd 的方法。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># yum install -y epel-release expect</span></div><div class="line">[root@192 ~]<span class="comment"># yum install -y pure-ftpd</span></div><div class="line">[root@192 ~]<span class="comment"># curl http://www.apelearn.com/study_v2/.pf.c &gt; /etc/pure-ftpd/pure-ftpd.conf</span></div><div class="line">[root@192 ~]<span class="comment"># user='mkpasswd -l 5 -s 0 -d 0 -C 0'</span></div><div class="line">[root@192 ~]<span class="comment"># pass='mkpasswd -s 0'</span></div><div class="line">[root@192 ~]<span class="comment"># echo $user $pass &gt; /tmp/ftp.pass</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;创建 ftp 服务的目录</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># mkdir -p /data/ftp</span></div><div class="line">[root@192 ~]<span class="comment"># echo -e "$pass\n$pass"|pure-pw useradd $user -u apache -d /data/ftp/</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;创建密码文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># pure-pw mkdb</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;列出用户</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># pure-pw list</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;删除帐号</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># pure-pw userdel $user</span></div></pre></td></tr></table></figure>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;启动服务</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">[root@192 ~]<span class="comment"># /etc/init.d/pure-ftpd start</span></div></pre></td></tr></table></figure>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/FTP/" rel="tag"># FTP</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/09/03/FTP/2. vsftp部署和优化/" rel="next" title="vsftp部署和优化">
                <i class="fa fa-chevron-left"></i> vsftp部署和优化
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/03/FTP/3. ftp的主动模式与被动模式的区别是什么？/" rel="prev" title="ftp的主动模式与被动模式的区别是什么？">
                ftp的主动模式与被动模式的区别是什么？ <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/0.png"
               alt="失落的乐章" />
          <p class="site-author-name" itemprop="name">失落的乐章</p>
           
              <p class="site-description motion-element" itemprop="description">失落的乐章的Blog</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/">
                <span class="site-state-item-count">627</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">38</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/hcldirgit" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装pure-ftpd"><span class="nav-number">1.</span> <span class="nav-text">安装pure-ftpd</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-下载软件"><span class="nav-number">1.1.</span> <span class="nav-text">1.下载软件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-安装-pure-ftpd"><span class="nav-number">1.2.</span> <span class="nav-text">2.安装 pure-ftpd</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-配置-pure-ftpd"><span class="nav-number">1.3.</span> <span class="nav-text">3.配置 pure-ftpd</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-启动-pure-ftpd"><span class="nav-number">1.4.</span> <span class="nav-text">4.启动 pure-ftpd</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-建立帐号"><span class="nav-number">1.5.</span> <span class="nav-text">5.建立帐号</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-测试-pure-ftpd"><span class="nav-number">1.6.</span> <span class="nav-text">6.测试 pure-ftpd</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">失落的乐章</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  




	





  





  





  






  





  

  

  

  

  

  

</body>
</html>
